﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "xlsxdocument.h"
#include "xlsxformat.h"
#include "xlsxcellrange.h"
#include "xlsxchart.h"
#include "xlsx/xlsxformat.h"
#include "xlsx/xlsxformat_p.h"
#include "xlsxworkbook.h"

#include <QDebug>

struct ExcelInfos
{
    QString filename;
    QStringList sheetnames;
    QString cntSheetName;
    int rowCount;
    int colCount;
    QList<QList<QVariant> > dataTable;
};


namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    QXlsx::Format setFormatStyleBlue();
    QXlsx::Format setFormatStyleRed();

    QXlsx::Format setHeaderFormatStyle();
    QXlsx::Format setSingleFormatStyle();
    QXlsx::Format setDoubleFormatStyle();

    void setGlobalTableData(QList<QList<QString> > listGlobalData);
    void exportExcel(QString fileName);

    QString getExcelItemData(QString fileName, QString itemName);
    QString getExcelItemData(QString fileName, int row, int col);
    QString getExcelAllInfos(QString fileName);


    QString getCntSheetName(QXlsx::Document &doc);
    QStringList getExcelSheetNames(QXlsx::Document &doc);

    ExcelInfos readExcel(QString filename);

    void dataSample();

private:
    Ui::MainWindow *ui;
    QList<QList<QString> > m_listGlobalData;


};

#endif // MAINWINDOW_H
